import { Component, OnInit } from '@angular/core';
import { BooksService} from '../service/books.service';
import { Book} from '../book';
import { RecordsService} from '../service/records.service';
import { Record} from '../record';
import { People} from '../people';
import { PeopleService} from '../service/people.service';
import {serialize} from '@angular/compiler/src/i18n/serializers/xml_helper';

@Component({
  selector: 'app-test',
  templateUrl: './test.component.html',
  styleUrls: ['./test.component.css']
})
export class TestComponent implements OnInit {
  constructor(private booksService: BooksService, private recordsService: RecordsService, private peopleService: PeopleService) { }
  people: People
  temp: People
  record: Record
  ngOnInit() {
    this.record = {
      id: 4,
      bid: 'H2345',
      pid: 3016218078,
      bdate: '2018-02-06',
      rdate: '2018-03-06',
      realDate: '2018-12-12',
    };
// 先改storage的内容，再改表
//     this.people = JSON.parse(sessionStorage.getItem('usr'));
//     this.people.count += 1;
//     this.peopleService.updateCount(this.people).then(res => {
//       console.log(res);
//       sessionStorage.setItem('usr', JSON.stringify(this.people));
//       return res;
//     });

    // this.booksService.getBooks().then(book => {
// 实现
//       console.log(book);
//       return book;
//     });
//     this.recordsService.getRecords().then(record => {
//       console.log(record);
//       return record;
//     });
//     this.recordsService.updateRealDate(this.record).then(record => {
//       return record;
//     });
    // this.recordsService.createRecord(this.record).then(record => {
    //   console.log(record);
    //   return record;
    // });
  }

}
